<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right" style="font-size: 16px;">
      <el-breadcrumb-item :to="{ path: '/' }"><i class="el-icon-house" style="font-weight: bold;color: black">&nbsp;&nbsp;后台管理</i>
      </el-breadcrumb-item>
      <el-breadcrumb-item><i class="el-icon-s-data" style="color: black">&nbsp;&nbsp;首页</i></el-breadcrumb-item>
    </el-breadcrumb>
    <div class="data-canRead" style="width: 100%;background-color: white;height: auto">
      <el-tabs type="border-card">
        <!--    财务管理数据查询    -->
        <el-tab-pane>
          <span slot="label"><i class="el-icon-s-data"></i>&nbsp;&nbsp;财务管理</span>
          <div class="model">
            <h2 style="text-align: center;margin-bottom: 36px">应收帐</h2>
            <div class="dom" id="receivables"></div>
            <div class="dom1">
              <h3 style="margin:12px 0 12px 12px">共{{ this.receivables.length }}条数据&nbsp;,&nbsp;其中有：</h3>
              <h4 style="margin:12px 0 12px 24px">生产费用:{{ this.SumSalary }}元</h4>
              <h4 style="margin:12px 0 12px 24px">外购费用:{{ this.SumSalary1 }}元</h4>
              <h4 style="margin:12px 0 12px 24px">管理费用:{{ this.SumSalary2 }}元</h4>
              <h4 style="margin:12px 0 12px 24px">财务费用:{{ this.SumSalary4 }}元</h4>
              <h4 style="margin:12px 0 12px 24px">营业费用:{{ this.SumSalary5 }}元</h4>
              <h3 style="margin:12px 0 12px 12px">经过数据检验，得出如下结果：</h3>
              <p style="margin:24px 24px 0 24px">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ this.receivableText }}
              </p>
            </div>
          </div>
          <div class="model">
            <h2 style="text-align: center;margin-bottom: 36px">固定资产</h2>
            <div class="dom1">
              <h3 style="margin:12px 0 12px 12px">共{{ this.fixedAssets.length }}条数据&nbsp;,&nbsp;其中有：</h3>
              <h4 style="margin:12px 0 12px 24px">数码设备 占据:{{ this.assetsValue }}元</h4>
              <h4 style="margin:12px 0 12px 24px">机器设备 占据:{{ this.assetsValue1 }}元</h4>
              <h4 style="margin:12px 0 12px 24px">办公设备 占据:{{ this.assetsValue2 }}元</h4>
              <h4 style="margin:12px 0 12px 24px">房屋建筑 占据:{{ this.assetsValue3 }}元</h4>
              <h4 style="margin:12px 0 12px 24px">公司财产 占据:{{ this.assetsValue4 }}元</h4>
              <h3 style="margin:12px 0 12px 12px">经过数据检验，得出如下结果：</h3>
              <p style="margin:24px 24px 0 24px">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ this.fixedAssetsText }}
              </p>
            </div>
            <div class="dom" id="fixedAssets"></div>
          </div>
          <div class="model">
            <h2 style="text-align: center;margin-bottom: 24px">工资表</h2>
            <el-input v-model="searchMonth" placeholder="请输入月份"
                      style="width: 300px;margin-left: 50px;margin-bottom: 12px"/>
            <br>
            <div class="dom" id="payRoll" style="margin-top: 48px"></div>
            <div class="dom1">
              <h3 style="margin:12px 0 12px 12px">{{ this.searchMonth0 }}份相关人员共{{ this.empSalary.length }}个人&nbsp;&nbsp;：</h3>
              <h4 style="margin:12px 0 12px 24px">收入低于5k有:{{ this.less5kCount }}人</h4>
              <h4 style="margin:12px 0 12px 24px">收入低于8k有:{{ this.less8kCount }}人</h4>
              <h4 style="margin:12px 0 12px 24px">收入低于12k有:{{ this.less12kCount }}人</h4>
              <h4 style="margin:12px 0 12px 24px">收入高于12k有:{{ this.highSalaryCount }}人</h4>
              <h3 style="margin:12px 0 12px 12px">经过数据检验，得出如下结果：</h3>
              <p style="margin:24px 24px 0 24px">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ this.empSalaryText }}
              </p>
            </div>
          </div>
        </el-tab-pane>
        <!--    销售管理数据查询    -->
        <el-tab-pane>
          <span slot="label"><i class="el-icon-s-marketing"></i>&nbsp;&nbsp;销售管理</span>
          <div class="model">
            <h2 style="text-align: center;margin-bottom: 36px">订单管理</h2>
            <div class="dom" id="sales"></div>
            <div class="dom1">
              <h3 style="margin:12px 0 12px 12px">共{{ this.sales.length }}条销售订单款项&nbsp;,&nbsp;其中：</h3>
              <h3 style="margin:12px 0 12px 12px">销售金额最高的款项为：<br>&nbsp;&nbsp;&nbsp;&nbsp;{{this.salesMaxName}}</h3>
              <h4 style="margin:12px 0 12px 12px">&nbsp;&nbsp;&nbsp;&nbsp;销售金额为：{{this.salesMax}}</h4>
              <h3 style="margin:12px 0 12px 12px">销售金额最低的款项为：<br>&nbsp;&nbsp;&nbsp;&nbsp;{{this.salesMinName}}</h3>
              <h4 style="margin:12px 0 12px 12px">&nbsp;&nbsp;&nbsp;&nbsp;销售金额为：{{this.salesMin}}</h4>
              <h4 style="margin:12px 0 12px 12px">经过数据检验，得出如下结果：</h4>
              <p style="margin:24px 24px 0 24px">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ this.salesText }}
              </p>
            </div>
          </div>
          <div class="model">
            <h2 style="text-align: center;margin-bottom: 36px">合同管理</h2>
            <div class="dom" id="agreement"></div>
            <div class="dom1">
              <h3 style="margin:12px 0 12px 12px">共{{ this.agreement.length }}条合同款项&nbsp;,&nbsp;其中：</h3>
              <h3 style="margin:12px 0 12px 12px">合同金额最高的款项为：</h3>
              <h4 style="margin:12px 0 12px 12px">&nbsp;&nbsp;&nbsp;&nbsp;{{this.agreementMaxName}}</h4>
              <h4 style="margin:12px 0 12px 12px">&nbsp;&nbsp;&nbsp;&nbsp;合同金额为：{{this.agreementMax}}</h4>
              <h3 style="margin:12px 0 12px 12px">合同金额最低的款项为：</h3>
              <h4 style="margin:12px 0 12px 12px">&nbsp;&nbsp;&nbsp;&nbsp;{{this.agreementMinName}}</h4>
              <h4 style="margin:12px 0 12px 12px">&nbsp;&nbsp;&nbsp;&nbsp;合同金额为：{{this.agreementMin}}</h4>
              <h3 style="margin:12px 0 12px 12px">经过数据检验，得出如下结果：</h3>
              <p style="margin:24px 24px 0 24px">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ this.agreementText }}
              </p>
            </div>
          </div>
        </el-tab-pane>
        <!--    采购管理数据查询    -->
        <el-tab-pane>
          <span slot="label"><i class="el-icon-s-claim"></i>&nbsp;&nbsp;采购管理</span>
          <div class="model">
            <h2 style="text-align: center;margin-bottom: 36px">订单发票</h2>
            <div class="dom" id="oderAndInvoice"></div>
            <div class="dom1">
              <h3 style="margin:12px 0 12px 12px">共{{ this.oderInvoice.length }}条订单发票款项&nbsp;,&nbsp;其中：</h3>
              <h3 style="margin:12px 0 12px 12px">订单金额最高的款项为：<br>&nbsp;&nbsp;&nbsp;&nbsp;{{this.oderInvoiceMaxName}}</h3>
              <h4 style="margin:12px 0 12px 12px">&nbsp;&nbsp;&nbsp;&nbsp;订单发票金额为：{{this.oderInvoiceMax}}</h4>
              <h3 style="margin:12px 0 12px 12px">订单金额最低的款项为：<br>&nbsp;&nbsp;&nbsp;&nbsp;{{this.oderInvoiceMinName}}</h3>
              <h4 style="margin:12px 0 12px 12px">&nbsp;&nbsp;&nbsp;&nbsp;订单发票金额为：{{this.oderInvoiceMin}}</h4>
              <h4 style="margin:12px 0 12px 12px">经过数据检验，得出如下结果：</h4>
              <p style="margin:24px 24px 0 24px">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ this.oderInvoiceText }}
              </p>
            </div>
          </div>
        </el-tab-pane>
        <!--    生产管理数据查询    -->
        <el-tab-pane>
          <span slot="label"><i class="el-icon-s-platform"></i>&nbsp;&nbsp;生产管理</span>
          <div class="model">
            <h2 style="text-align: center;margin-bottom: 36px">进度查询</h2>
            <div class="dom" id="progress"></div>
            <div class="dom1" style="width: 600px">
              <h3 style="margin:12px 0 12px 12px">共{{ this.progress.length }}个项目&nbsp;,&nbsp;其中：</h3>
              <h4 style="margin:12px 0 12px 24px">{{ this.progressIsOver }}个项目已结束----总金额：{{ this.progressIsOverCost }}元</h4>
              <h4 style="margin:12px 0 12px 24px">{{ this.progressUnOver }}个项目进行中----总金额：{{ this.progressUnOverCost }}元</h4>
              <h4 style="margin:12px 0 12px 24px">目前最高开销项目为：{{ this.progressMaxName }}</h4>
              <h4 style="margin:12px 0 12px 24px">----该项目{{this.progressMaxIsOverOrNot}} ， 相关开销金额为：{{ this.progressMaxCost}}元</h4>
              <h4 style="margin:12px 0 12px 24px">目前最低开销项目为：{{ this.progressMinName }}</h4>
              <h4 style="margin:12px 0 12px 24px">----该项目{{this.progressMaxIsOverOrNot}} ， 相关开销金额为:{{ this.progressMinCost }}元</h4>
              <h3 style="margin:12px 0 12px 12px">经过数据检验，得出如下结果：</h3>
              <p style="margin:24px 24px 0 24px">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ this.progressText }}
              </p>
            </div>
          </div>
          <div class="model">
            <h2 style="text-align: center;margin-bottom: 36px">材料查询</h2>
            <div class="dom1">
              <h3 style="margin:12px 0 12px 12px">材料总计{{ this.material.length }}款项&nbsp;,&nbsp;其中：</h3>
              <h4 style="margin:12px 0 12px 24px">目前最高占比材料为：{{ this.materialMaxName }}</h4>
              <h4 style="margin:12px 0 12px 24px">----该材料的数量为{{this.materialMax}}</h4>
              <h4 style="margin:12px 0 12px 24px">目前最低占比材料为：{{ this.materialMinName }}</h4>
              <h4 style="margin:12px 0 12px 24px">----该材料的数量为{{this.materialMin}}</h4>
              <h3 style="margin:12px 0 12px 12px">经过统计，得出如下结果：</h3>
              <p style="margin:24px 24px 0 24px">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ this.materialText }}
              </p>
            </div>
            <div class="dom" id="material"></div>
          </div>
        </el-tab-pane>
        <!--    仓库管理数据查询    -->
        <el-tab-pane>
          <span slot="label"><i class="el-icon-s-shop"></i>&nbsp;&nbsp;仓库管理</span>
          <div class="model">
            <h2 style="text-align: center;margin-bottom: 36px">质检查询</h2>
            <div class="dom" id="quality"></div>
            <div class="dom1">
              <h3 style="margin:12px 0 12px 12px">共{{ this.quality.length }}件产品&nbsp;,&nbsp;其中：</h3>
              <h4 style="margin:12px 0 12px 24px">合格的产品有:{{ this.qualityPassCount }}件</h4>
              <h4 style="margin:12px 0 12px 24px">不合格的产品有:{{ this.qualityRejectCount }}件</h4>
              <h4 style="margin:12px 0 12px 24px">平均合格率:{{ this.qualityPassRate }}%</h4>
              <h4 style="margin:12px 0 12px 24px">平均不合格率:{{ this.qualityRejectRate }}%</h4>
              <h3 style="margin:12px 0 12px 12px">经过数据检验，得出如下结果：</h3>
              <p style="margin:24px 24px 0 24px">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ this.qualityText }}
              </p>
            </div>
          </div>
          <div class="model">
            <h2 style="text-align: center;margin-bottom: 36px">库存查询</h2>
            <div class="dom1">
              <h3 style="margin:12px 0 12px 12px">仓库中共有{{ this.category.length }}件产品&nbsp;,&nbsp;其中：</h3>
              <h4 style="margin:12px 0 12px 24px">{{ this.categoryMaxName }}价值最高</h4>
              <h4 style="margin:12px 0 12px 24px">----价值最高为{{ this.categoryMaxValue }}元</h4>
              <h4 style="margin:12px 0 12px 24px">{{ this.categoryMinName }}价值最低</h4>
              <h4 style="margin:12px 0 12px 24px">----价值最低为{{ this.categoryMinValue }}元</h4>
              <h3 style="margin:12px 0 12px 12px">经过数据检验，得出如下结果：</h3>
              <p style="margin:24px 24px 0 24px">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ this.categoryText }}
              </p>
            </div>
            <div class="dom" id="category"></div>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script>
//通过this.$echarts来使用
export default {
  data() {
    return {
      //应收帐内容物
      receivables: [],
      Receivable: {
        id: '',
        date: '',
        incomeType: '',
        description: '',
        amount: '',
        tradeMethods: '',
        remarks: ''
      },
      receivableText: '',
      SumSalary: '',//生产
      SumSalary1: '',//外购
      SumSalary2: '',//管理
      SumSalary4: '',//财务
      SumSalary5: '',//营业
      //固定资产
      fixedAssetsForm: {
        id: '',
        assetName: '',
        assetId: '',
        assetClassification: '',
        originValueAsset: '',
        dateAcquisition: '',
        specificationModel: '',
        responsePerson: '',
        remarks: ''
      },
      fixedAssets: [],
      fixedAssetsText: '',
      assetsValue: '',//数码
      assetsValue1: '',//机器
      assetsValue2: '',//办公
      assetsValue3: '',//房屋
      assetsValue4: '',//公司
      //工资核算表
      searchMonth: '',
      searchMonth0: '全年月',
      empForm: {
        id: '',
        month: '',
        employeeId: '',
        name: '',
        gender: '',
        hiredate: '',
        deptId: '',
        job: '',
        compensatoryDays: '',
        attendanceDays: '',
        baseFunds: '',
        postFunds: '',
        subsidy: '',
        publicAccumulationFunds: '',
        jobLifeFunds: '',
        lessFunds: '',
        remarks: '',
        sumSalary: '',
      },
      empSalary: [],
      empSalaryCopy: [],
      less5kCount: '',//[0,5k]
      less8kCount: '',//[5k,8k]
      less12kCount: '',//[5k,12k]
      highSalaryCount: '',//[12k,+]
      empSalaryText: '',//文本
      //质检
      quality: [],
      qualityForm: {
        id: '',
        date: '',
        name: '',
        dateId: '',
        yield: '',
        isCheck: '',
        remarks: '',
        qualifiedNumber: '',
        nonConformitiesNumber: '',
        failureRate: '',
      },
      qualityText: '',//结果文本
      qualityRejectCount: '',//不合格数
      qualityRejectRate: '',//平均不合格率
      qualityPassCount: '',//平均合格数率
      qualityPassRate: '',//平均合格数率
      //库存
      category: [],
      categoryForm: {
        categoryId: '',
        name: '',
        lmonth: '',
        tmonthIn: '',
        tmonthOut: '',
        countNow: '',
        count: '',
        overflowShort: '',
        unitPrice: '',
        primeCost: '',
        inventoryAmount: '',
      },
      categoryMaxName: '',//价值最高的产品
      categoryMaxValue: '',//最高价值
      categoryMinName: '',//价值最低产品
      categoryMinValue: '',//最低价值
      categoryText: '',//库存文本
      //进度
      progress: [],
      progressForm: {
        id: '',
        projectId: '',
        projectName: '',
        name: '',
        cell: '',
        email: '',
        expectedTime: '',
        start: '',
        end: '',
        checkOver: '',
        cost: '',
      },
      progressIsOver:'',
      progressMaxIsOverOrNot:'',
      progressMinIsOverOrNot:'',
      progressUnOver:'',
      progressIsOverCost:'',
      progressUnOverCost:'',
      progressMaxName: '',//开销最高的项目
      progressMaxCost: '',//最高开销
      progressMinName: '',//开销最低项目
      progressMinCost: '',//最低开销
      progressText: '',//进度文本
      //材料
      material: [],
      materialForm: {
        registrationTime: '',
        name: '',
        unitIn: '',
        countIn: '',
        resIn: '',
        unitOut: '',
        countOut: '',
        resOut: '',
        count: '',
      },
      materialMaxName:'',
      materialMax:'',
      materialMin:'',
      materialMinName:'',
      materialText:'',
      //销售
      sales:[],
      salesForm: {
        id: '',
        orderDate: '',
        orderId: '',
        category: '',
        unit: '',
        count: '',
        unitPrice: '',
        amount: '',
        customName: '',
        cell: '',
        deliveryDate: '',
        deliveryOdd: '',
        deliveryCheck: '',
      },
      salesMaxName:'',
      salesMax:'',
      salesMin:'',
      salesMinName:'',
      salesText:'',
      //合同
      agreement: [],
      agreementForm: {
        id: '',
        name: '',
        salesType: '',
        dateSale: '',
        oddNumber: '',
        sales: '',
        drawback: '',
        sum: '',
        deduction: '',
        collection: '',
        dateColl: '',
        dateReceive: '',
      },
      agreementMaxName:'',
      agreementMax:'',
      agreementMin:'',
      agreementMinName:'',
      agreementText:'',
      //订单发票
      oderInvoice: [],
      oderInvoiceForm: {
        commodityCode: '',
        commodityName: '',
        amount: '',
        specs: '',
        companyName: '',
        count: '',
        // invoice: '',
      },
      oderInvoiceMaxName:'',
      oderInvoiceMax:'',
      oderInvoiceMin:'',
      oderInvoiceMinName:'',
      oderInvoiceText:'',
      //供应商
      suppliers: [],
      suppliersForm: {
        id:'',
        name: '',
        address: '',
        contract: '',
        cell: '',
        email: '',
        categoryType: '',
        transport: '',
        cost: '',
      },
      supplier:{value:'',name:''},
      suppliersMaxName:'',
      suppliersMax:'',
      suppliersMin:'',
      suppliersMinName:'',
      suppliersText:'',
    }
  },
  mounted() {
    setTimeout(()=>{
      //应收帐
      this.echartsInitReceivables();
      //固定资产
      this.echartsInitFixedAssets();
      //工资核算
      this.echartsInitPayRoll();
      //质检
      this.echartsQuality();
      //库存
      this.echartsCategory();
      //进度
      this.echartsProgress();
      //材料
      this.echartsMaterial();
      //客户
      this.echartsSales();
      //合同
      this.echartsAgreement();
      //订单发票
      this.echartsOderInvoice();
    })
  },
  methods: {
    //应收帐初始化方法
    echartsInitReceivables() {
      /*后端获取数据*/
      let url = 'http://localhost:9080/financeReceivables';
      // console.log('url = ' + url);
      let SumAmount = 0;
      let SumAmount1 = 0;
      let SumAmount2 = 0;
      let SumAmount4 = 0;
      let SumAmount5 = 0;
      let text = '';
      this.axios
          .create({'headers': {'Authorization': localStorage.getItem('jwt')}})
          .get(url).then((response) => {
        let responseBody = response.data;
        this.receivables = responseBody.data;
        let receive = responseBody.data;
        // console.log(data)
        receive.forEach((_) => {
          this.Receivable = _;
          // console.log(this.Receivable.amount)
          if (this.Receivable.incomeType === '生产费用') {
            SumAmount += parseInt(this.Receivable.amount)
          }
          if (this.Receivable.incomeType === '外购费用') {
            SumAmount1 += parseInt(this.Receivable.amount)
          }
          if (this.Receivable.incomeType === '管理费用') {
            SumAmount2 += parseInt(this.Receivable.amount)
          }
          if (this.Receivable.incomeType === '财务费用') {
            SumAmount4 += parseInt(this.Receivable.amount)
          }
          if (this.Receivable.incomeType === '营业费用') {
            SumAmount5 += parseInt(this.Receivable.amount)
          }
        })
        if (SumAmount > SumAmount1 && SumAmount > SumAmount2 && SumAmount > SumAmount4 && SumAmount > SumAmount5) {
          let rate = SumAmount / (SumAmount + SumAmount1 + SumAmount2 + SumAmount4 + SumAmount5) * 100 + "";
          let num = rate.substring(0, rate.indexOf('.') + 3);
          text = "生产费用占据了主要收入 ，收入占比达到了" + num + "%";
        }
        if (SumAmount1 > SumAmount && SumAmount1 > SumAmount2 && SumAmount1 >> SumAmount4 && SumAmount1 > SumAmount5) {
          let rate = SumAmount1 / (SumAmount + SumAmount1 + SumAmount2 + SumAmount4 + SumAmount5) * 100 + "";
          let num = rate.substring(0, rate.indexOf('.') + 3);
          text = "外购费用占据了主要的收入 ，收入占比达到了" + num + "%";
        }
        if (SumAmount2 > SumAmount && SumAmount2 > SumAmount1 && SumAmount2 > SumAmount4 && SumAmount2 > SumAmount5) {
          let rate = SumAmount2 / (SumAmount + SumAmount1 + SumAmount2 + SumAmount4 + SumAmount5) * 100 + "";
          let num = rate.substring(0, rate.indexOf('.') + 3);
          text = "管理费用占据了主要的收入 ，收入占比达到了" + num + "%";
        }
        if (SumAmount4 > SumAmount1 && SumAmount4 > SumAmount2 && SumAmount4 > SumAmount && SumAmount4 > SumAmount5) {
          let rate = SumAmount4 / (SumAmount + SumAmount1 + SumAmount2 + SumAmount4 + SumAmount5) * 100 + "";
          let num = rate.substring(0, rate.indexOf('.') + 3);
          text = "财务费用占据了主要的收入 ，收入占比达到了" + num + "%";
        }
        if (SumAmount5 > SumAmount1 && SumAmount5 > SumAmount2 && SumAmount5 > SumAmount4 && SumAmount5 > SumAmount) {
          let rate = SumAmount5 / (SumAmount + SumAmount1 + SumAmount2 + SumAmount4 + SumAmount5) * 100 + "";
          let num = rate.substring(0, rate.indexOf('.') + 3);
          text = "营业费用占据了主要的收入 ，收入占比达到了" + num + "%";
        }
        if (SumAmount < SumAmount1 && SumAmount < SumAmount2 && SumAmount < SumAmount4 && SumAmount < SumAmount5) {
          let rate1 = SumAmount / (SumAmount + SumAmount1 + SumAmount2 + SumAmount4 + SumAmount5) * 100 + "";
          let num1 = rate1.substring(0, rate1.indexOf('.') + 3);
          text += "而生产费用只占据了部分的收入 ，收入微弱占比" + num1 + "% , 建议相关部门之间做好协调 。";
        }
        if (SumAmount1 < SumAmount && SumAmount1 < SumAmount2 && SumAmount1 < SumAmount4 && SumAmount1 < SumAmount5) {
          let rate1 = SumAmount1 / (SumAmount + SumAmount1 + SumAmount2 + SumAmount4 + SumAmount5) * 100 + "";
          let num1 = rate1.substring(0, rate1.indexOf('.') + 3);
          text += "而外购费用只占据了部分的收入 ，收入微弱占比" + num1 + "% , 建议相关部门之间做好协调 。";
        }
        if (SumAmount2 < SumAmount && SumAmount2 < SumAmount1 && SumAmount2 < SumAmount4 && SumAmount2 < SumAmount5) {
          let rate1 = SumAmount2 / (SumAmount + SumAmount1 + SumAmount2 + SumAmount4 + SumAmount5) * 100 + "";
          let num1 = rate1.substring(0, rate1.indexOf('.') + 3);
          text += "而管理费用只占据了部分的收入 ，收入微弱占比" + num1 + "% , 建议相关部门之间做好协调 。";
        }
        if (SumAmount4 < SumAmount1 && SumAmount4 < SumAmount2 && SumAmount4 < SumAmount && SumAmount4 < SumAmount5) {
          let rate1 = SumAmount4 / (SumAmount + SumAmount1 + SumAmount2 + SumAmount4 + SumAmount5) * 100 + "";
          let num1 = rate1.substring(0, rate1.indexOf('.') + 3);
          text += "而财务费用只占据了部分的费用支出 ，支出微弱占比" + num1 + "% , 建议相关部门之间做好协调 。";
        }
        if (SumAmount5 < SumAmount1 && SumAmount5 < SumAmount2 && SumAmount5 < SumAmount4 && SumAmount5 < SumAmount) {
          let rate1 = SumAmount5 / (SumAmount + SumAmount1 + SumAmount2 + SumAmount4 + SumAmount5) * 100 + "";
          let num1 = rate1.substring(0, rate1.indexOf('.') + 3);
          text += "而营业费用只占据了部分的收入 ，收入微弱占比" + num1 + "% , 建议相关部门之间做好协调 。";
        }

        this.SumSalary = SumAmount;
        this.SumSalary1 = SumAmount1;
        this.SumSalary2 = SumAmount2;
        this.SumSalary4 = SumAmount4;
        this.SumSalary5 = SumAmount5;
        this.receivableText = text;
        this.$echarts.init(document.getElementById('receivables')).setOption({
          title: {
            subtext: 'Receivables',
            left: 'center'
          },
          xAxis: {
            type: 'category',
            data: ['生产费用', '外购费用', '管理费用', '财务费用', '营业费用']
          },
          yAxis: {
            type: 'value'
          },
          series: [{
            data: [SumAmount, SumAmount1, SumAmount2, SumAmount4, SumAmount5],
            type: 'bar',
          }],
        })
      });
    },
    //固定资产初始化方法
    echartsInitFixedAssets() {
      let url = 'http://localhost:9080/financeFixedAssets';
      // console.log('url = ' + url);
      let assetValue = 0;
      let assetValue1 = 0;
      let assetValue2 = 0;
      let assetValue3 = 0;
      let assetValue4 = 0;
      let text = "";
      this.axios
          .create({'headers': {'Authorization': localStorage.getItem('jwt')}})
          .get(url).then((response) => {
        let responseBody = response.data;
        this.fixedAssets = responseBody.data;
        let fixedAsset = responseBody.data;
        // console.log(fixedAsset)
        fixedAsset.forEach((_) => {
          this.fixedAssetsForm = _;
          // console.log(this.fixedAssetsForm.originValueAsset)
          if (this.fixedAssetsForm.assetClassification === '数码设备') {
            assetValue += parseInt(this.fixedAssetsForm.originValueAsset)
          }
          if (this.fixedAssetsForm.assetClassification === '机器设备') {
            assetValue1 += parseInt(this.fixedAssetsForm.originValueAsset)
          }
          if (this.fixedAssetsForm.assetClassification === '办公设备') {
            assetValue2 += parseInt(this.fixedAssetsForm.originValueAsset)
          }
          if (this.fixedAssetsForm.assetClassification === '房屋建筑') {
            assetValue3 += parseInt(this.fixedAssetsForm.originValueAsset)
          }
          if (this.fixedAssetsForm.assetClassification === '公司财产') {
            assetValue4 += parseInt(this.fixedAssetsForm.originValueAsset)
          }
        })
        if (assetValue > assetValue1 && assetValue > assetValue2 && assetValue > assetValue4 && assetValue > assetValue3) {
          let rate = assetValue / (assetValue + assetValue1 + assetValue2 + assetValue4 + assetValue3) * 100 + "";
          let num = rate.substring(0, rate.indexOf('.') + 3);
          text = "数码设备占据了主要占比,达到了" + num + "%";
        }
        if (assetValue1 > assetValue && assetValue1 > assetValue2 && assetValue1 >> assetValue4 && assetValue1 > assetValue3) {
          let rate = assetValue1 / (assetValue + assetValue1 + assetValue2 + assetValue4 + assetValue3) * 100 + "";
          let num = rate.substring(0, rate.indexOf('.') + 3);
          text = "机器设备占据了主要占比,达到了" + num + "%";
        }
        if (assetValue2 > assetValue && assetValue2 > assetValue1 && assetValue2 > assetValue4 && assetValue2 > assetValue3) {
          let rate = assetValue2 / (assetValue + assetValue1 + assetValue2 + assetValue4 + assetValue3) * 100 + "";
          let num = rate.substring(0, rate.indexOf('.') + 3);
          text = "办公设备占据了主要占比,达到了" + num + "%";
        }
        if (assetValue4 > assetValue1 && assetValue4 > assetValue2 && assetValue4 > assetValue && assetValue4 > assetValue3) {
          let rate = assetValue4 / (assetValue + assetValue1 + assetValue2 + assetValue4 + assetValue3) * 100 + "";
          let num = rate.substring(0, rate.indexOf('.') + 3);
          text = "房屋建筑占据了主要占比,达到了" + num + "%";
        }
        if (assetValue3 > assetValue1 && assetValue3 > assetValue2 && assetValue3 > assetValue4 && assetValue3 > assetValue) {
          let rate = assetValue3 / (assetValue + assetValue1 + assetValue2 + assetValue4 + assetValue3) * 100 + "";
          let num = rate.substring(0, rate.indexOf('.') + 3);
          text = "公司财产占据了主要占比,达到了" + num + "%";
        }
        if (assetValue < assetValue1 && assetValue < assetValue2 && assetValue < assetValue4 && assetValue < assetValue3) {
          let rate1 = assetValue / (assetValue + assetValue1 + assetValue2 + assetValue4 + assetValue3) * 100 + "";
          let num1 = rate1.substring(0, rate1.indexOf('.') + 3);
          text += "而数码设备只占据了微弱占比" + num1 + "% 。";
        }
        if (assetValue1 < assetValue && assetValue1 < assetValue2 && assetValue1 < assetValue4 && assetValue1 < assetValue3) {
          let rate1 = assetValue1 / (assetValue + assetValue1 + assetValue2 + assetValue4 + assetValue3) * 100 + "";
          let num1 = rate1.substring(0, rate1.indexOf('.') + 3);
          text += "而机器设备只占据了微弱占比" + num1 + "% 。";
        }
        if (assetValue2 < assetValue && assetValue2 < assetValue1 && assetValue2 < assetValue4 && assetValue2 < assetValue3) {
          let rate1 = assetValue2 / (assetValue + assetValue1 + assetValue2 + assetValue4 + assetValue3) * 100 + "";
          let num1 = rate1.substring(0, rate1.indexOf('.') + 3);
          text += "而办公设备只占据了微弱占比" + num1 + "% 。";
        }
        if (assetValue4 < assetValue1 && assetValue4 < assetValue2 && assetValue4 < assetValue && assetValue4 < assetValue3) {
          let rate1 = assetValue4 / (assetValue + assetValue1 + assetValue2 + assetValue4 + assetValue3) * 100 + "";
          let num1 = rate1.substring(0, rate1.indexOf('.') + 3);
          text += "而房屋建筑只占据了微弱占比" + num1 + "% 。";
        }
        if (assetValue3 < assetValue1 && assetValue3 < assetValue2 && assetValue3 < assetValue4 && assetValue3 < assetValue) {
          let rate1 = assetValue3 / (assetValue + assetValue1 + assetValue2 + assetValue4 + assetValue3) * 100 + "";
          let num1 = rate1.substring(0, rate1.indexOf('.') + 3);
          text += "而房屋建筑只占据了微弱占比" + num1 + "% 。";
        }

        this.fixedAssetsText = text;
        this.assetsValue = assetValue;
        this.assetsValue1 = assetValue1;
        this.assetsValue2 = assetValue2;
        this.assetsValue3 = assetValue3;
        this.assetsValue4 = assetValue4;
        this.$echarts.init(document.getElementById('fixedAssets')).setOption({
          title: {
            text: '固定资产饼状图',
            subtext: 'FixedAssets',
            left: 'center'
          },
          tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b} : {c} ({d}%)'
          },
          toolbox: {
            show: true,
            feature: {
              dataView: {show: true, readOnly: false},
              restore: {show: true},
              saveAsImage: {show: true}
            }
          },
          legend: {
            bottom: 10,
            left: 'center',
            data: ['数码设备', '机器设备', '办公设备', '房屋建筑', '公司财产']
          },
          series: [
            {
              type: 'pie',
              radius: '65%',
              center: ['50%', '50%'],
              selectedMode: 'single',
              data: [
                {
                  value: 1548,
                  label: {
                    backgroundColor: '#eee',
                    borderColor: '#777',
                    borderWidth: 1,
                    borderRadius: 4,
                    rich: {
                      title: {
                        color: '#eee',
                        align: 'center'
                      },
                      abg: {
                        backgroundColor: '#333',
                        width: '100%',
                        align: 'right',
                        height: 25,
                        borderRadius: [4, 4, 0, 0]
                      },
                      Sunny: {
                        height: 30,
                        align: 'left',
                      },
                      Cloudy: {
                        height: 30,
                        align: 'left',
                      },
                      Showers: {
                        height: 30,
                        align: 'left',
                      },
                      weatherHead: {
                        color: '#333',
                        height: 24,
                        align: 'left'
                      },
                      hr: {
                        borderColor: '#777',
                        width: '100%',
                        borderWidth: 0.5,
                        height: 0
                      },
                      value: {
                        width: 20,
                        padding: [0, 20, 0, 30],
                        align: 'left'
                      },
                      valueHead: {
                        color: '#333',
                        width: 20,
                        padding: [0, 20, 0, 30],
                        align: 'center'
                      },
                      rate: {
                        width: 40,
                        align: 'right',
                        padding: [0, 10, 0, 0]
                      },
                      rateHead: {
                        color: '#333',
                        width: 40,
                        align: 'center',
                        padding: [0, 10, 0, 0]
                      }
                    }
                  }
                },
                {value: assetValue, name: '数码设备'},
                {value: assetValue1, name: '机器设备'},
                {value: assetValue2, name: '办公设备'},
                {value: assetValue3, name: '房屋建筑'},
                {value: assetValue4, name: '公司财产'},
              ],
              emphasis: {
                itemStyle: {
                  shadowBlur: 10,
                  shadowOffsetX: 0,
                  shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
              }
            }
          ]
        })
      });
    },
    //工资核算表
    echartsInitPayRoll() {
      let url = 'http://localhost:9080/financePayrolls';
      // console.log('url = ' + url);
      this.axios
          .create({'headers': {'Authorization': localStorage.getItem('jwt')}})
          .get(url).then((response) => {
        let responseBody = response.data;
        if (responseBody.state == 20000) {
          this.empSalary = responseBody.data;
          this.empSalaryCopy = this.empSalary;
          this.echartsPayRollChange();
        } else {
          this.$message.error(responseBody.message);
        }
      });
    },
    echartsPayRollChange() {
      // console.log(this.empSalary);
      // console.log(this.empSalaryCopy);
      let less5kCount = 0;
      let less8kCount = 0;
      let less12kCount = 0;
      let highSalaryCount = 0;

      let less5kCountFM = 0;
      let less5kCountM = 0;
      let less8kCountFM = 0;
      let less8kCountM = 0;

      let less12kCountFM = 0;
      let less12kCountM = 0;
      let highSalaryCountFM = 0;
      let highSalaryCountM = 0;

      let emp = this.empSalary;
      emp.forEach((_) => {
        // console.log(_)
        this.empForm = _;
        if (this.empForm.sumSalary < 5000) {
          less5kCount += 1;
          if (this.empForm.gender === '男') {
            less5kCountFM += 1
          } else {
            less5kCountM += 1
          }
        } else if (this.empForm.sumSalary < 8000) {
          less8kCount += 1;
          if (this.empForm.gender === '男') {
            less8kCountFM += 1
          } else {
            less8kCountM += 1
          }
        } else if (this.empForm.sumSalary < 12000) {
          less12kCount += 1;
          if (this.empForm.gender === '男') {
            less12kCountFM += 1
          } else {
            less12kCountM += 1
          }
        } else {
          highSalaryCount += 1;
          if (this.empForm.gender === '男') {
            highSalaryCountFM += 1
          } else {
            highSalaryCountM += 1
          }
        }
      });
      this.$echarts.init(document.getElementById('payRoll')).dispose();
      this.$echarts.init(document.getElementById('payRoll')).setOption({
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross',
            crossStyle: {
              color: '#999'
            }
          }
        },
        toolbox: {
          feature: {
            dataView: {show: true, readOnly: false},
            magicType: {show: true, type: ['line', 'bar']},
            restore: {show: true},
            saveAsImage: {show: true}
          }
        },
        legend: {
          data: ['男性', '女性', '总人数']
        },
        xAxis: [
          {
            type: 'category',
            data: ['收入低于5K', '收入5K至8K', '收入8K至12K', '收入12K以上'],
            axisPointer: {
              type: 'shadow'
            }
          }
        ],
        yAxis: [
          {
            type: 'value',
            name: '男性人数',
            axisLabel: {
              formatter: '{value} 人'
            }
          },
          {
            type: 'value',
            name: '女性人数',
            axisLabel: {
              formatter: '{value} 人'
            }
          }
        ],
        series: [
          {
            name: '男性',
            type: 'bar',
            tooltip: {
              valueFormatter: function (value) {
                return value + ' 人';
              }
            },
            data: [less5kCountFM, less8kCountFM, less12kCountFM, highSalaryCountFM]
          },
          {
            name: '女性',
            type: 'bar',
            tooltip: {
              valueFormatter: function (value) {
                return value + ' 人';
              }
            },
            data: [less5kCountM, less8kCountM, less12kCountM, highSalaryCountM]
          },
          {
            name: '总人数',
            type: 'line',
            yAxisIndex: 1,
            tooltip: {
              valueFormatter: function (value) {
                return value + ' 人';
              }
            },
            data: [less5kCount, less8kCount, less12kCount, highSalaryCount]
          }
        ]
      });
      this.less5kCount = less5kCount;
      this.less8kCount = less8kCount;
      this.less12kCount = less12kCount;
      this.highSalaryCount = highSalaryCount;
      let empSalaryText = "本月中，收入低于5k的群体中有" + less5kCountM + "人为女性，" + less5kCountFM + "人为男性，"
          + "在5k到8k的区间中，男性有" + less8kCountFM + "人，女性有" + less8kCountM + "人，而在8k到12k的区间中，" +
          "男性则有" + less12kCountFM + "人，女性有" + less12kCountM + "人，" +
          "少部分人处于高收入水平，其中男性有" + highSalaryCountFM + "人，女性有" + highSalaryCountM + "人。";
      let femaleRate = 100 * (less12kCountFM + highSalaryCountFM + less5kCountFM + less8kCountFM) / this.empSalary.length + "";
      let num = femaleRate.substring(0, femaleRate.indexOf('.') + 3);
      let maleRate = 100 - num;
      if (femaleRate > maleRate) {
        empSalaryText += "总体观察，男性作为主要占比占据了" + num + "%的总人数，而女性则占据了" + maleRate + "%的人数，需要企业自行协调 ！";
      } else {
        empSalaryText += "总体观察，女作作为主要占比占据了" + maleRate + "%的总人数，而男性则占据了" + num + "%的人数，需要企业自行协调 ！";
      }
      this.empSalaryText = empSalaryText;
    },
    searchByMonth(keywords) {
      return this.empSalary.filter(item => {
        if (item.month === keywords) {
          return item
        }
      })
    },
    //质检
    echartsQuality() {
      let url = 'http://localhost:9080/wareHouseQuality';
      // console.log('url = ' + url);

      let qualityPassCount = 0;
      let qualityRejectCount = 0;

      let qualityPassRate = 0;
      let qualityRejectRate = 0;

      let qualityText = "";

      this.axios
          .create({'headers': {'Authorization': localStorage.getItem('jwt')}})
          .get(url).then((response) => {
        let responseBody = response.data;
        this.quality = responseBody.data;

        let quality = responseBody.data;
        quality.forEach((_) => {
          this.qualityForm = _;
          if (this.qualityForm.isCheck === '是') {
            qualityPassCount += 1;
            // console.log("qualityPassCount="+qualityPassCount)
            if (qualityPassRate == 0) {
              qualityPassRate = this.qualityForm.failureRate;
              // console.log("qualityPassRate="+qualityPassRate)
            } else {
              qualityPassRate += this.qualityForm.failureRate;
              qualityPassRate = qualityPassRate / 2;
            }
            // console.log("qualityPassRate="+qualityPassRate)
          } else {
            qualityRejectCount += 1;
            if (qualityRejectRate == 0) {
              qualityRejectRate = this.qualityForm.failureRate;
            } else {
              qualityRejectRate += this.qualityForm.failureRate;
              qualityRejectRate = qualityRejectRate / 2;
            }
          }
        });
        this.$echarts.init(document.getElementById('quality')).setOption({
          title: {
            subtext: 'Category_Quality  Checking',
            left: 'center'
          },
          tooltip: {
            trigger: 'item'
          },
          legend: {
            orient: 'vertical',
            left: 'left'
          },
          toolbox: {
            show: true,
            feature: {
              dataView: {show: true, readOnly: false},
              restore: {show: true},
              saveAsImage: {show: true}
            }
          },
          series: [
            {
              name: '产品合格一览图',
              type: 'pie',
              radius: '50%',
              data: [
                {
                  value: qualityPassCount,
                  name: '合格的产品 : ' + ((100 - qualityPassCount / (qualityPassCount + qualityRejectCount)) + "").substring(0, ((100 - qualityPassCount / (qualityPassCount + qualityRejectCount)) + "").indexOf('.') + 3) + " %"
                },
                {
                  value: qualityRejectCount,
                  name: '不合格的产品 : ' + ((qualityRejectCount / (qualityPassCount + qualityRejectCount)) + "").substring(0, ((qualityRejectCount / (qualityPassCount + qualityRejectCount)) + "").indexOf('.') + 3) + " %"
                },
              ],
              emphasis: {
                itemStyle: {
                  shadowBlur: 10,
                  shadowOffsetX: 0,
                  shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
              }
            }
          ]
        });
        qualityPassRate = (100 - qualityPassRate + "").substring(0, (100 - qualityPassRate + "").indexOf('.') + 3);
        this.qualityPassCount = qualityPassCount;
        this.qualityRejectCount = qualityRejectCount;
        this.qualityPassRate = qualityPassRate;
        this.qualityRejectRate = qualityRejectRate;
        this.qualityText = "经检验，有" + qualityPassCount + "件产品达到了合格的要求，而不合格的产品数量达到了"
            + qualityRejectCount + "件，因此需要企业进行自我协调，另外产品总的平均合格率依旧达到了" + qualityPassRate + "%，而不合格率还存在着" + qualityRejectRate + "% 。"
      });
    },
    //库存
    echartsCategory() {
      let url = 'http://localhost:9080/wareHouseCategory';
      // console.log('url = ' + url);

      this.axios
          .create({'headers': {'Authorization': localStorage.getItem('jwt')}})
          .get(url).then((response) => {
        let responseBody = response.data;
        this.category = responseBody.data;
        // console.log('state=' + responseBody.state);
        // console.log('message=' + responseBody.message);
        // console.log('fixedAssets=' + responseBody.data);
        let category = responseBody.data;
        const categoryName = [];
        const categoryValue = [];
        let min = 0;
        let max = 0;
        let sum = 0;
        let maxName = "";
        let minName = "";
        category.forEach((_) => {
          this.categoryForm = _;
          if (this.categoryForm.inventoryAmount > max) {
            if (min > max) {
              min = max;
              minName = maxName;
            }
            if (min == 0) {
              min = this.categoryForm.inventoryAmount;
              minName = this.categoryForm.name;
            }
            max = this.categoryForm.inventoryAmount;
            maxName = this.categoryForm.name;
          } else {
            if (min > this.categoryForm.inventoryAmount) {
              min = this.categoryForm.inventoryAmount;
              minName = this.categoryForm.name;
            }
          }
          sum += this.categoryForm.inventoryAmount;
          categoryName.push(this.categoryForm.name);
          categoryValue.push(this.categoryForm.inventoryAmount);
          // console.log("max="+max)
          // console.log("maxName="+maxName)
          // console.log("min="+min)
          // console.log("minName="+minName)
          this.categoryMaxName = maxName;
          this.categoryMaxValue = max;
          this.categoryMinName = minName;
          this.categoryMinValue = min;
          this.categoryText = "经过综合统计，仓库目前存储了" + this.category.length + "件商品，仓库内的总价值为" + sum + "元，" +
              "其中商品" + maxName + "价值最高为" + max + "元，金额占比" + ((100 * (max / sum)) + "").substring(0, ((100 * (max / sum)) + "").indexOf('.') + 3) + "%，而" +
              "商品" + minName + "最低价值则为" + min + "元，金额占比" + ((100 * (min / sum)) + "").substring(0, ((100 * (min / sum)) + "").indexOf('.') + 3) + "%，" +
              "整个仓库内存储的平均价值为" + ((sum / this.category.length) + "").substring(0, ((sum / this.category.length) + "").indexOf('.') + 3) + "元"
        });
        this.$echarts.init(document.getElementById('category')).setOption({
          title: {
            text: '库存仓库数量一览',
            subtext: 'Category_Count & Worth'
          },
          tooltip: {
            trigger: 'axis'
          },
          legend: {
            data: ['产品类别']
          },
          toolbox: {
            show: true,
            feature: {
              dataView: {show: true, readOnly: false},
              magicType: {show: true, type: ['line', 'bar']},
              restore: {show: true},
              saveAsImage: {show: true}
            }
          },
          calculable: true,
          xAxis: [
            {
              type: 'category',
              // prettier-ignore
              data: categoryName
            }
          ],
          yAxis: [
            {
              type: 'value'
            }
          ],
          series: [
            {
              name: '产品类别',
              type: 'bar',
              data: categoryValue,
              markPoint: {
                data: [
                  {type: 'max', name: 'Max'},
                  {type: 'min', name: 'Min'}
                ]
              },
              markLine: {
                data: [{type: 'average', name: 'Avg'}]
              }
            },
          ]
        })
      });
    },
    //进度
    echartsProgress() {
      let url = 'http://localhost:9080/produceProgress';
      console.log('url = ' + url);
      this.axios
          .create({'headers': {'Authorization': localStorage.getItem('jwt')}})
          .get(url).then((response) => {
        let responseBody = response.data;
        if (responseBody.state == 20000) {
          this.progressOptions = responseBody.data;
          this.progress = responseBody.data;
          let projectIsOver = 0;
          let projectUnOver = 0;
          let projectIsOverCost = 0;
          let projectUnOverCost = 0;

          let max = 0;
          let maxName = 0;
          let min = 0;
          let sum = 0;
          let isOrNotMax = "";
          let isOrNotMin = "";
          let minName = 0;

          const projectInOver = [];
          const projectDisOver = [];
          const projectName = [];

          let progress = responseBody.data;
          progress.forEach((_) => {
            this.progressForm = _;
            sum += this.progressForm.cost;
            if (this.progressForm.checkOver === '是') {
              projectIsOver += 1;
              projectIsOverCost += this.progressForm.cost;
              projectInOver.push(this.progressForm.cost);
            } else {
              projectUnOver += 1;
              projectUnOverCost += this.progressForm.cost;
              projectDisOver.push(this.progressForm.cost);
            }
            projectName.push(this.progressForm.projectName);
            if (this.progressForm.cost > max) {
              if (min > max) {
                min = max;
                minName = maxName;
                isOrNotMin = isOrNotMax;
              }
              if (min == 0) {
                min = this.progressForm.cost;
                minName = this.progressForm.projectName;
                isOrNotMin = this.progressForm.checkOver
              }
              max = this.progressForm.cost;
              maxName = this.progressForm.projectName;
              isOrNotMax = this.progressForm.checkOver
            } else {
              if (min > this.progressForm.cost) {
                min = this.progressForm.cost;
                minName = this.progressForm.projectName;
                isOrNotMin = this.progressForm.checkOver
              }
            }
          });

          if(isOrNotMax === '是'){this.progressMaxIsOverOrNot = "已结束"}else {this.progressMaxIsOverOrNot = "进行中"}
          if(isOrNotMin === '是'){this.progressMinIsOverOrNot = "已结束"}else {this.progressMinIsOverOrNot = "进行中"}
          this.progressMaxCost = max;
          this.progressMinCost = min;
          this.progressMaxName = maxName;
          this.progressMinName = minName;

          this.progressUnOver = projectUnOver;
          this.progressIsOver = projectIsOver;
          this.progressIsOverCost = projectIsOverCost;
          this.progressUnOverCost = projectUnOverCost;

          let progressText = "项目总共有"+this.progress.length+"项，其中，截至目前，"+maxName+"项目开支占比最高，"+minName+"项目开支占比最低，整个项目组已有"+projectIsOver+"项结束，仍还有"+projectUnOver+"项处于进行中。"
          if(parseInt(((max/sum) * 100+"").substring(0,((max/sum) * 100+"").indexOf('.')+3))> 50 ){
            progressText += "由于项目"+maxName+"开支金额达到了"+((max/sum) * 100+"").substring(0,((max/sum) * 100+"").indexOf('.')+3)+"%，开销过高 ！ 故希望各部门做好协调 ！";
          }
          this.progressText = progressText;

          this.$echarts.init(document.getElementById('progress')).setOption({
            title: {
              text: '各项目进度情况一览',
              subtext: 'Progress Checking'
            },
            tooltip: {
              trigger: 'axis'
            },
            legend: {
              data: ['已结束项目', '进行中项目']
            },
            toolbox: {
              show: true,
              feature: {
                dataView: { show: true, readOnly: false },
                magicType: { show: true, type: ['line', 'bar'] },
                restore: { show: true },
                saveAsImage: { show: true }
              }
            },
            calculable: true,
            xAxis: [
              {
                type: 'category',
                // prettier-ignore
                data: projectName
              }
            ],
            yAxis: [
              {
                type: 'value'
              }
            ],
            series: [
              {
                name: '已结束项目',
                type: 'bar',
                data: projectInOver,
                markPoint: {
                  data: [
                    { type: 'max', name: 'Max' },
                    { type: 'min', name: 'Min' }
                  ]
                },
                markLine: {
                  data: [{ type: 'average', name: 'Avg' }]
                }
              },
              {
                name: '进行中项目',
                type: 'bar',
                data: projectDisOver,
                markPoint: {
                  data: [
                    { name: 'Max', value: 182.2, xAxis: 7, yAxis: 183 },
                    { name: 'Min', value: 2.3, xAxis: 11, yAxis: 3 }
                  ]
                },
                markLine: {
                  data: [{ type: 'average', name: 'Avg' }]
                }
              }
            ]
          });
        } else {
          this.$message.error(responseBody.message);
        }
      });
    },
    //材料
    echartsMaterial(){
      let url = 'http://localhost:9080/produceMaterials';
      // console.log('url = ' + url);
      const materialName = [];
      const materialCount = [];

      let min = 0;
      let max = 0;
      let sumCount = 0;
      let maxName = "";
      let minName = "";

      this.axios
          .create({'headers': {'Authorization': localStorage.getItem('jwt')}})
          .get(url).then((response) => {
        let responseBody = response.data;
        if (responseBody.state == 20000) {
          this.material = responseBody.data;
          let material = responseBody.data;
          material.forEach((_)=>{
            this.materialForm = _;
            sumCount += this.materialForm.count;
            if (this.materialForm.count > max) {
              if (min > max) {
                min = max;
                minName = maxName;
              }
              if (min == 0) {
                min = this.materialForm.count;
                minName = this.materialForm.name;
              }
              max = this.materialForm.count;
              maxName = this.materialForm.name;
            } else {
              if (min > this.materialForm.count) {
                min = this.materialForm.count;
                minName = this.materialForm.name;
              }
            }

            this.materialMax = max;
            this.materialMin = min;
            this.materialMaxName = maxName;
            this.materialMinName = minName;

            this.materialText = "材料总计"+this.material.length+"条款项，其中"+maxName+"数量最多，有"+max+"量的存货，"+minName+"数量最少为"+min+"项，" +
                "在全部材料款项中，"+max+"占据了总数量的"+(((max/sumCount)*100+"").substring(0,((max/sumCount)*100+"").indexOf('.'))+3) + "%的内存，而"+min+
                "款项占据了总数的"+ (((min/sumCount)*100+"").substring(0,((min/sumCount)*100+"").indexOf('.'))+3) +"%，希望有关部门注意协调，并定期检查材料是否过期 ！"
            materialName.push(this.materialForm.name);
            materialCount.push(this.materialForm.count);
          });
          this.$echarts.init(document.getElementById('material')).setOption({
            title: {
              text: '材料表一览',
              subtext: 'Material Checking'
            },
            tooltip: {
              trigger: 'axis'
            },
            legend: {
              data: ['材料']
            },
            toolbox: {
              show: true,
              feature: {
                dataView: { show: true, readOnly: false },
                magicType: { show: true, type: ['line', 'bar'] },
                restore: { show: true },
                saveAsImage: { show: true }
              }
            },
            calculable: true,
            xAxis: [
              {
                type: 'category',
                // prettier-ignore
                data: materialName
              }
            ],
            yAxis: [
              {
                type: 'value'
              }
            ],
            series: [
              {
                name: '材料',
                type: 'bar',
                data: materialCount,
                markPoint: {
                  data: [
                    { type: 'max', name: 'Max' },
                    { type: 'min', name: 'Min' }
                  ]
                },
                markLine: {
                  data: [{ type: 'average', name: 'Avg' }]
                }
              },
            ]
          });
        } else {
          this.$message.error(responseBody.message);
        }
      });
    },
    //订单
    echartsSales(){
      let url = 'http://localhost:9080/customSales';
      console.log('url = ' + url);

      const salesName = [];
      const salesAmount = [];

      let min = 0;
      let max = 0;

      let maxName = "";
      let minName = "";

      this.axios
          .create({'headers': {'Authorization': localStorage.getItem('jwt')}})
          .get(url).then((response) => {
        let responseBody = response.data;
        if (responseBody.state == 20000) {
          this.sales = responseBody.data;
          let sales = responseBody.data;
          sales.forEach((_)=>{
            this.salesForm = _;
            let name = this.salesForm.orderId +"， "+ this.salesForm.category
            // console.log(name)
            // console.log(this.salesForm.orderId)
            // console.log(this.salesForm.category)
            salesName.push(name);
            salesAmount.push(this.salesForm.amount);

            if (this.salesForm.amount > max) {
              if (min > max) {
                min = max;
                minName = maxName;
              }
              if (min == 0) {
                min = this.salesForm.amount;
                minName = name;
              }
              max = this.salesForm.amount;
              maxName = name;
            } else {
              if (min > this.salesForm.amount) {
                min = this.salesForm.amount;
                minName = name;
              }
            }
          });

          this.salesMin = min;
          this.salesMinName = minName;
          this.salesMax = max;
          this.salesMaxName = maxName;

          this.salesText = "经过统计分析，"+maxName+"条款的金额占比最多，"+minName+"的金额占比较少";

          this.$echarts.init(document.getElementById('sales')).setOption({
            title: {
              text: '销售表单一览',
              subtext: 'SaleLists Checking'
            },
            tooltip: {
              trigger: 'axis'
            },
            legend: {
              data: ['销售订单']
            },
            toolbox: {
              show: true,
              feature: {
                dataView: { show: true, readOnly: false },
                magicType: { show: true, type: ['line', 'bar'] },
                restore: { show: true },
                saveAsImage: { show: true }
              }
            },
            calculable: true,
            xAxis: [
              {
                type: 'category',
                // prettier-ignore
                data: salesName
              }
            ],
            yAxis: [
              {
                type: 'value'
              }
            ],
            series: [
              {
                name: '销售订单',
                type: 'bar',
                data: salesAmount,
                markPoint: {
                  data: [
                    { type: 'max', name: 'Max' },
                    { type: 'min', name: 'Min' }
                  ]
                },
                markLine: {
                  data: [{ type: 'average', name: 'Avg' }]
                }
              },
            ]
          });
        } else {
          this.$message.error(responseBody.message);
        }
      });
    },
    //合同
    echartsAgreement(){
      let url = 'http://localhost:9080/customAgreements';
      console.log('url = ' + url);

      const agreementName = [];
      const agreementAmount = [];

      let min = 0;
      let max = 0;

      let maxName = "";
      let minName = "";

      this.axios
          .create({'headers': {'Authorization': localStorage.getItem('jwt')}})
          .get(url).then((response) => {
        let responseBody = response.data;
        if (responseBody.state == 20000) {
          this.agreement = responseBody.data;
          let agreement = responseBody.data;
          agreement.forEach((_)=>{
            this.agreementForm = _;
            let name = this.agreementForm.oddNumber +"， "+ this.agreementForm.name
            agreementName.push(name);
            agreementAmount.push(this.agreementForm.sum);

            if (this.agreementForm.sum > max) {
              if (min > max) {
                min = max;
                minName = maxName;
              }
              if (min == 0) {
                min = this.agreementForm.sum;
                minName = name;
              }
              max = this.agreementForm.sum;
              maxName = name;
            } else {
              if (min > this.agreementForm.sum) {
                min = this.agreementForm.sum;
                minName = name;
              }
            }
          });

          this.agreementMin = min;
          this.agreementMinName = minName;
          this.agreementMax = max;
          this.agreementMaxName = maxName;

          this.agreementText = "经过统计分析，"+maxName+"条款的金额占比最多，"+minName+"的金额占比较少";

          this.$echarts.init(document.getElementById('agreement')).setOption({
              title: {
                text: '合同表单一览',
                subtext: 'AgreementLists Checking'
              },
              tooltip: {
                trigger: 'axis'
              },
              legend: {
                data: ['合同管理']
              },
              toolbox: {
                show: true,
                feature: {
                  dataView: { show: true, readOnly: false },
                  magicType: { show: true, type: ['line', 'bar'] },
                  restore: { show: true },
                  saveAsImage: { show: true }
                }
              },
              calculable: true,
              xAxis: [
                {
                  type: 'category',
                  // prettier-ignore
                  data: agreementName
                }
              ],
              yAxis: [
                {
                  type: 'value'
                }
              ],
              series: [
                {
                  name: '合同管理',
                  type: 'bar',
                  data: agreementAmount,
                  markPoint: {
                    data: [
                      { type: 'max', name: 'Max' },
                      { type: 'min', name: 'Min' }
                    ]
                  },
                  markLine: {
                    data: [{ type: 'average', name: 'Avg' }]
                  }
                },
              ]
          });
        } else {
          this.$message.error(responseBody.message);
        }
      });
    },
    //订饭发票
    echartsOderInvoice(){
      let url = 'http://localhost:9080/purchaseOderandinvoices/list';
      console.log('url = ' + url);

      const name = [];
      const amount = [];
      const count = [];

      let min = 0;
      let max = 0;

      let maxName = "";
      let minName = "";

      this.axios
          .create({'headers': {'Authorization': localStorage.getItem('jwt')}})
          .get(url).then((response) => {
        let responseBody = response.data;
        if (responseBody.state == 20000) {
          let companyList = responseBody.data;
          this.oderInvoice = companyList;
          let oderAndInvoice = responseBody.data;
          oderAndInvoice.forEach((_)=>{
            this.oderInvoiceForm = _;

            name.push(this.oderInvoiceForm.commodityName);
            amount.push(this.oderInvoiceForm.amount);
            count.push(this.oderInvoiceForm.count);

            if (this.oderInvoiceForm.amount > max) {
              if (min > max) {
                min = max;
                minName = maxName;
              }
              if (min == 0) {
                min = this.oderInvoiceForm.amount;
                minName = this.oderInvoiceForm.commodityName;
              }
              max = this.oderInvoiceForm.amount;
              maxName = this.oderInvoiceForm.commodityName;
            } else {
              if (min > this.oderInvoiceForm.amount) {
                min = this.oderInvoiceForm.amount;
                minName = this.oderInvoiceForm.commodityName;
              }
            }
          });

          this.oderInvoiceMax = max;
          this.oderInvoiceMin = min;
          this.oderInvoiceMaxName = maxName;
          this.oderInvoiceMinName = minName;

          this.oderInvoiceText = "经过统计分析，"+maxName+"条款的金额占比最多，"+minName+"的金额占比较少";

          this.$echarts.init(document.getElementById('oderAndInvoice')).setOption({
            tooltip: {
              trigger: 'axis',
              axisPointer: {
                type: 'cross',
                crossStyle: {
                  color: '#999'
                }
              }
            },
            toolbox: {
              feature: {
                dataView: {show: true, readOnly: false},
                magicType: {show: true, type: ['line', 'bar']},
                restore: {show: true},
                saveAsImage: {show: true}
              }
            },
            legend: {
              data: ['发票订单金额', '商品需求量']
            },
            xAxis: [
              {
                type: 'category',
                data: name,
                axisPointer: {
                  type: 'shadow'
                }
              }
            ],
            yAxis: [
              {
                type: 'value',
                name: '发票订单金额',
                axisLabel: {
                  formatter: '{value} 元'
                }
              },
              {
                type: 'value',
                name: '商品需求量',
                axisLabel: {
                  formatter: '{value} 件'
                }
              }
            ],
            series: [
              {
                name: '发票订单金额',
                type: 'bar',
                tooltip: {
                  valueFormatter: function (value) {
                    return value + ' 元';
                  }
                },
                data: amount
              },
              {
                name: '商品需求量',
                type: 'line',
                yAxisIndex: 1,
                tooltip: {
                  valueFormatter: function (value) {
                    return value + ' 件';
                  }
                },
                data: count
              },
            ]
          });
        } else {
          this.$message.error(responseBody.message);
        }
      });
    },
  },
  watch: {
    //工资核算表查询
    searchMonth: function (val) {
      if (val == '') {
        this.empSalary = this.empSalaryCopy
        this.searchMonth0 = "全年月"
      } else {
        this.empSalary = this.searchByMonth(val)
        this.searchMonth0 = this.searchMonth;
      }
      this.echartsPayRollChange();
    },
  }
}
</script>

<style scope>

.data-canRead {
  width: 380px;
  height: 380px;
  margin-top: 15px;
  box-shadow: 0px 5px 5px #8d858a;
  float: left;
  margin-right: 16px;
}

.dom {
  width: 800px;
  height: 500px;
  float: left;
  margin: 0 0 24px 24px;
}

.dom1 {
  width: 300px;
  height: 450px;
  float: left;
  margin: 50px 0 24px 24px;
  border: 1px solid gray;
  border-radius: 30px;
}

.model {
  float: left;
  margin-bottom: 30px;
}

</style>